#include "Utilities.h"

#include <sstream>
#include <fstream>
#include <iostream>

using namespace std;

void writeResult(vector<size_t> const &res, bool magic, string const &filename) {
    ofstream outputfile (filename, ios::app);
    if (outputfile.is_open())
    {
        for (int i = 0; i != res.size() - 1; ++i)
            outputfile << res[i] << ',';
        outputfile << res[res.size() - 1] << '\n';
        outputfile.close();
    }    
}

void writeResult(vector<int> const &res, bool magic, string const &filename) {
    ofstream outputfile (filename, ios::app);
    if (outputfile.is_open())
    {
        for (int i = 0; i != res.size() - 1; ++i)
            outputfile << res[i] << ',';
        outputfile << res[res.size() - 1] << '\n';
        outputfile.close();
    }    
}


string prettyString(int t, int l)
{
    stringstream ss;
    int fac = 10;
    
    for(int i = 1; i != l; ++i)
    {
        if (t < fac)
            ss << '0';
        fac *= 10;
    }    
    
    ss << t;
    return ss.str();
}

void pausePrint(string const &str)
{
    cout << str;
    while(cin.get() != '\n'){}
}

void pauseTilEnter()
{
    while(cin.get() != '\n'){}
}
